<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"/><meta name="viewport" content="width=device-width, initial-scale=0.8"/><title>17.2&nbsp;读取器扩展</title><link rel="stylesheet" type="text/css" href="scribble.css" title="default"/><link rel="stylesheet" type="text/css" href="icons.css" title="default"/><link rel="stylesheet" type="text/css" href="racket.css" title="default"/><link rel="stylesheet" type="text/css" href="manual-style.css" title="default"/><link rel="stylesheet" type="text/css" href="manual-racket.css" title="default"/><script type="text/javascript" src="scribble-common.js"></script><script type="text/javascript" src="manual-racket.js"></script><!--[if IE 6]><style type="text/css">.SIEHidden { overflow: hidden; }</style><![endif]--></head><body id="scribble-racket-lang-org"><div class="tocset"><div class="tocview"><div class="tocviewlist tocviewlisttopspace"><div class="tocviewtitle"><table cellspacing="0" cellpadding="0"><tr><td style="width: 1em;"><a href="javascript:void(0);" title="Expand/Collapse" class="tocviewtoggle" onclick="TocviewToggle(this,&quot;tocview_0&quot;);">&#9658;</a></td><td></td><td><a href="index.html" class="tocviewlink" data-pltdoc="x">Racket&#25351;&#21335;</a></td></tr></table></div><div class="tocviewsublisttop" style="display: none;" id="tocview_0"><table cellspacing="0" cellpadding="0"><tr><td align="right">1&nbsp;</td><td><a href="intro.html" class="tocviewlink" data-pltdoc="x">&#27426;&#36814;&#26469;&#21040;Racket!</a></td></tr><tr><td align="right">2&nbsp;</td><td><a href="to-scheme.html" class="tocviewlink" data-pltdoc="x">Racket&#27010;&#35201;</a></td></tr><tr><td align="right">3&nbsp;</td><td><a href="datatypes.html" class="tocviewlink" data-pltdoc="x">&#20869;&#32622;&#30340;&#25968;&#25454;&#31867;&#22411;</a></td></tr><tr><td align="right">4&nbsp;</td><td><a href="scheme-forms.html" class="tocviewlink" data-pltdoc="x">&#34920;&#36798;&#24335;&#21644;&#23450;&#20041;</a></td></tr><tr><td align="right">5&nbsp;</td><td><a href="define-struct.html" class="tocviewlink" data-pltdoc="x">&#31243;&#24207;&#21592;&#23450;&#20041;&#30340;&#25968;&#25454;&#31867;&#22411;</a></td></tr><tr><td align="right">6&nbsp;</td><td><a href="modules.html" class="tocviewlink" data-pltdoc="x">&#27169;&#22359;</a></td></tr><tr><td align="right">7&nbsp;</td><td><a href="contracts.html" class="tocviewlink" data-pltdoc="x">&#21512;&#32422;</a></td></tr><tr><td align="right">8&nbsp;</td><td><a href="i_o.html" class="tocviewlink" data-pltdoc="x">&#36755;&#20837;&#21644;&#36755;&#20986;</a></td></tr><tr><td align="right">9&nbsp;</td><td><a href="regexp.html" class="tocviewlink" data-pltdoc="x">&#27491;&#21017;&#34920;&#36798;&#24335;</a></td></tr><tr><td align="right">10&nbsp;</td><td><a href="control.html" class="tocviewlink" data-pltdoc="x">&#24322;&#24120;&#19982;&#25511;&#21046;</a></td></tr><tr><td align="right">11&nbsp;</td><td><a href="for.html" class="tocviewlink" data-pltdoc="x">&#36845;&#20195;&#21644;&#25512;&#23548;</a></td></tr><tr><td align="right">12&nbsp;</td><td><a href="match.html" class="tocviewlink" data-pltdoc="x">&#27169;&#24335;&#21305;&#37197;</a></td></tr><tr><td align="right">13&nbsp;</td><td><a href="classes.html" class="tocviewlink" data-pltdoc="x">&#31867;&#21644;&#23545;&#35937;</a></td></tr><tr><td align="right">14&nbsp;</td><td><a href="units.html" class="tocviewlink" data-pltdoc="x">&#21333;&#20803;</a></td></tr><tr><td align="right">15&nbsp;</td><td><a href="reflection.html" class="tocviewlink" data-pltdoc="x">&#21453;&#23556;&#21644;&#21160;&#24577;&#27714;&#20540;</a></td></tr><tr><td align="right">16&nbsp;</td><td><a href="macros.html" class="tocviewlink" data-pltdoc="x">&#23439;</a></td></tr><tr><td align="right">17&nbsp;</td><td><a href="languages.html" class="tocviewselflink" data-pltdoc="x">&#21019;&#36896;&#35821;&#35328;</a></td></tr><tr><td align="right">18&nbsp;</td><td><a href="concurrency.html" class="tocviewlink" data-pltdoc="x">&#24182;&#21457;&#19982;&#21516;&#27493;</a></td></tr><tr><td align="right">19&nbsp;</td><td><a href="performance.html" class="tocviewlink" data-pltdoc="x">&#24615;&#33021;</a></td></tr><tr><td align="right">20&nbsp;</td><td><a href="parallelism.html" class="tocviewlink" data-pltdoc="x">&#24182;&#34892;</a></td></tr><tr><td align="right">21&nbsp;</td><td><a href="running.html" class="tocviewlink" data-pltdoc="x">&#36816;&#34892;&#21644;&#21019;&#24314;&#21487;&#25191;&#34892;&#31243;&#24207;</a></td></tr><tr><td align="right">22&nbsp;</td><td><a href="More_Libraries.html" class="tocviewlink" data-pltdoc="x">&#26356;&#22810;&#30340;&#24211;</a></td></tr><tr><td align="right">23&nbsp;</td><td><a href="dialects.html" class="tocviewlink" data-pltdoc="x">Racket&#21644;Scheme&#30340;&#26041;&#35328;</a></td></tr><tr><td align="right">24&nbsp;</td><td><a href="other-editors.html" class="tocviewlink" data-pltdoc="x">&#21629;&#20196;&#34892;&#24037;&#20855;&#21644;&#20320;&#30340;&#32534;&#36753;&#22120;&#36873;&#25321;</a></td></tr><tr><td align="right"></td><td><a href="doc-bibliography.html" class="tocviewlink" data-pltdoc="x">Bibliography</a></td></tr><tr><td align="right"></td><td><a href="doc-index.html" class="tocviewlink" data-pltdoc="x">Index</a></td></tr></table></div></div><div class="tocviewlist"><table cellspacing="0" cellpadding="0"><tr><td style="width: 1em;"><a href="javascript:void(0);" title="Expand/Collapse" class="tocviewtoggle" onclick="TocviewToggle(this,&quot;tocview_1&quot;);">&#9660;</a></td><td>17&nbsp;</td><td><a href="languages.html" class="tocviewlink" data-pltdoc="x">&#21019;&#36896;&#35821;&#35328;</a></td></tr></table><div class="tocviewsublist" style="display: block;" id="tocview_1"><table cellspacing="0" cellpadding="0"><tr><td align="right">17.1&nbsp;</td><td><a href="module-languages.html" class="tocviewlink" data-pltdoc="x">&#27169;&#22359;&#65288;module&#65289;&#35821;&#35328;</a></td></tr><tr><td align="right">17.2&nbsp;</td><td><a href="" class="tocviewselflink" data-pltdoc="x">&#35835;&#21462;&#22120;&#25193;&#23637;</a></td></tr><tr><td align="right">17.3&nbsp;</td><td><a href="hash-languages.html" class="tocviewlink" data-pltdoc="x">&#23450;&#20041;&#26032;&#30340;<span class="RktModLink"><span class="RktMod">#lang</span></span>&#35821;&#35328;</a></td></tr></table></div></div><div class="tocviewlist"><table cellspacing="0" cellpadding="0"><tr><td style="width: 1em;"><a href="javascript:void(0);" title="Expand/Collapse" class="tocviewtoggle" onclick="TocviewToggle(this,&quot;tocview_2&quot;);">&#9658;</a></td><td>17.2&nbsp;</td><td><a href="" class="tocviewselflink" data-pltdoc="x">&#35835;&#21462;&#22120;&#25193;&#23637;</a></td></tr></table><div class="tocviewsublistbottom" style="display: none;" id="tocview_2"><table cellspacing="0" cellpadding="0"><tr><td align="right">17.2.1&nbsp;</td><td><a href="#%28part._.Source_.Locations%29" class="tocviewlink" data-pltdoc="x">&#28304;&#20301;&#32622;</a></td></tr><tr><td align="right">17.2.2&nbsp;</td><td><a href="#%28part._readtable%29" class="tocviewlink" data-pltdoc="x">readtable&#65288;&#35835;&#21462;&#34920;&#26684;&#65289;</a></td></tr></table></div></div></div><div class="tocsub"><div class="tocsubtitle">On this page:</div><table class="tocsublist" cellspacing="0"><tr><td><span class="tocsublinknumber">17.2.1<tt>&nbsp;</tt></span><a href="#%28part._.Source_.Locations%29" class="tocsubseclink" data-pltdoc="x">&#28304;&#20301;&#32622;</a></td></tr><tr><td><span class="tocsublinknumber">17.2.2<tt>&nbsp;</tt></span><a href="#%28part._readtable%29" class="tocsubseclink" data-pltdoc="x">readtable&#65288;&#35835;&#21462;&#34920;&#26684;&#65289;</a></td></tr></table></div></div><div class="maincolumn"><div class="main"><div class="navsettop"><span class="navleft"><div class="nosearchform"></div>&nbsp;&nbsp;</span><span class="navright">&nbsp;&nbsp;<a href="module-languages.html" title="backward to &quot;17.1 模块（module）语言&quot;" data-pltdoc="x">&larr; prev</a>&nbsp;&nbsp;<a href="languages.html" title="up to &quot;17 创造语言&quot;" data-pltdoc="x">up</a>&nbsp;&nbsp;<a href="hash-languages.html" title="forward to &quot;17.3 定义新的#lang语言&quot;" data-pltdoc="x">next &rarr;</a></span>&nbsp;</div><h4>17.2<tt>&nbsp;</tt><a name="(part._hash-reader)"></a>&#35835;&#21462;&#22120;&#25193;&#23637;</h4><blockquote class="refpara"><blockquote class="refcolumn"><blockquote class="refcontent"><p><span class="imageleft"><img src="magnify.png" alt="+" width="24" height="24"/></span><font class="badlink">(part ("(lib scribblings/reference/reference.scrbl)" "parse-reader"))</font> in <a href="https://docs.racket-lang.org/reference/index.html">The Racket Reference</a> provides more on &#35835;&#21462;&#22120;&#25193;&#23637;.</p></blockquote></blockquote></blockquote><p>Racket&#35821;&#35328;<a href="Pairs-Lists-and-Racket-Syntax.html#%28tech._~e8~af~bb~e5~8f~96~e5~99~a8~ef~bc~88reader~ef~bc~89%29" class="techoutside" data-pltdoc="x"><span class="techinside">&#35835;&#21462;&#22120;&#65288;reader&#65289;</span></a>&#23618;&#21487;&#20197;&#36890;&#36807;<span class="RktMeta">#reader</span>&#34920;&#25193;&#23637;&#12290;&#19968;&#20010;&#35835;&#21462;&#22120;&#25193;&#23637;&#20316;&#20026;&#19968;&#20010;&#27169;&#22359;&#23454;&#29616;&#65292;&#35813;&#27169;&#22359;&#22312;<span class="RktMeta">#reader</span>&#20043;&#21518;&#21629;&#21517;&#12290;&#27169;&#22359;&#23548;&#20986;&#30340;&#20989;&#25968;&#23558;&#21407;&#22987;&#23383;&#31526;&#35299;&#26512;&#25104;&#19968;&#20010;&#34987;<a href="Pairs-Lists-and-Racket-Syntax.html#%28tech._~e6~89~a9~e5~b1~95~e5~99~a8~ef~bc~88expander~ef~bc~89%29" class="techoutside" data-pltdoc="x"><span class="techinside">&#25193;&#23637;&#22120;&#65288;expander&#65289;</span></a>&#23618;&#25509;&#21463;&#30340;&#34920;&#12290;</p><p><span class="RktMeta">#reader</span>&#30340;&#35821;&#27861;&#26159;</p><blockquote class="SCodeFlow"><p><span class="RktInBG"><span class="hspace"></span><span class="RktIn">#reader</span><span class="hspace"></span></span><span class="hspace">&nbsp;</span><span class="sroman">&#8249;<span style="font-style: italic">module-path</span>&#8250;</span><span class="hspace">&nbsp;</span><span class="sroman">&#8249;<span style="font-style: italic">reader-specific</span>&#8250;</span></p></blockquote><p>&#22312;<span class="sroman">&#8249;<span style="font-style: italic">module-path</span>&#8250;</span>&#21629;&#21517;&#19968;&#20010;&#27169;&#22359;&#65292;&#23427;&#25552;&#20379;<span class="RktSym">read</span>&#21644;<span class="RktSym">read-syntax</span>&#20989;&#25968;&#12290;<span class="sroman">&#8249;<span style="font-style: italic">reader-specific</span>&#8250;</span>&#37096;&#20998;&#26159;&#19968;&#20010;&#23383;&#31526;&#24207;&#21015;&#65292;&#23427;&#34987;&#35299;&#26512;&#20026;&#30830;&#23450;&#8212;&#8212;&#34987;&#26469;&#33258;<span class="sroman">&#8249;<span style="font-style: italic">module-path</span>&#8250;</span>&#30340;<span class="RktSym">read</span>&#21644;<span class="RktSym">read-syntax</span>&#20989;&#25968;&#12290;</p><p>&#20363;&#22914;&#65292;&#20551;&#35774;&#25991;&#20214;<span class="stt">"five.rkt"</span>&#21253;&#21547;</p><blockquote class="SCodeFlow"><blockquote class="Rfilebox"><p class="Rfiletitle"><span class="Rfilename"><span class="stt">"five.rkt"</span></span></p><blockquote class="Rfilecontent"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><font class="badlink"><span class="RktModLink"><span class="RktMod">#lang</span></span></font><span class="hspace">&nbsp;</span><font class="badlink"><span class="RktModLink"><span class="RktSym">racket/base</span></span></font></td></tr><tr><td><span class="hspace">&nbsp;</span></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">provide</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym"><span class="badlink"><span class="RktValLink">read</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym"><span class="badlink"><span class="RktValLink">read-syntax</span></span></span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;</span></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">read</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">in</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">list</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">read-string</span></span></span><span class="hspace">&nbsp;</span><span class="RktVal">5</span><span class="hspace">&nbsp;</span><span class="RktSym">in</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">read-syntax</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">src</span><span class="hspace">&nbsp;</span><span class="RktSym">in</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">list</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">read-string</span></span></span><span class="hspace">&nbsp;</span><span class="RktVal">5</span><span class="hspace">&nbsp;</span><span class="RktSym">in</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></blockquote></blockquote></blockquote><p>&#37027;&#20040;&#65292;&#31243;&#24207;</p><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><font class="badlink"><span class="RktModLink"><span class="RktMod">#lang</span></span></font><span class="hspace">&nbsp;</span><font class="badlink"><span class="RktModLink"><span class="RktSym">racket/base</span></span></font></td></tr><tr><td><span class="hspace">&nbsp;</span></td></tr><tr><td><span class="RktVal">'</span><span class="RktVal">(</span><span class="RktVal">1</span><span class="hspace">&nbsp;</span><span class="RktMeta">#reader</span><span class="RktVal">"five.rkt"</span><span class="stt">23456</span><span class="RktVal">7</span><span class="hspace">&nbsp;</span><span class="RktVal">8</span><span class="RktVal">)</span></td></tr></table></blockquote><p>&#30456;&#24403;&#20110;</p><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><font class="badlink"><span class="RktModLink"><span class="RktMod">#lang</span></span></font><span class="hspace">&nbsp;</span><font class="badlink"><span class="RktModLink"><span class="RktSym">racket/base</span></span></font></td></tr><tr><td><span class="hspace">&nbsp;</span></td></tr><tr><td><span class="RktVal">'</span><span class="RktVal">(</span><span class="RktVal">1</span><span class="hspace">&nbsp;</span><span class="RktVal">(</span><span class="RktVal">"23456"</span><span class="RktVal">)</span><span class="hspace">&nbsp;</span><span class="RktVal">7</span><span class="hspace">&nbsp;</span><span class="RktVal">8</span><span class="RktVal">)</span></td></tr></table></blockquote><p>&#22240;&#20026;<span class="stt">"five.rkt"</span>&#30340;<span class="RktSym">read</span>&#21644;<span class="RktSym">read-syntax</span>&#20989;&#25968;&#26082;&#20174;&#36755;&#20837;&#27969;&#20013;&#35835;&#21462;&#20116;&#20010;&#23383;&#31526;&#21448;&#25226;&#23427;&#20204;&#25918;&#20837;&#19968;&#20010;&#23383;&#31526;&#20018;&#36827;&#32780;&#25104;&#20026;&#19968;&#20010;&#21015;&#34920;&#12290;&#26469;&#33258;<span class="stt">"five.rkt"</span>&#30340;&#35835;&#21462;&#22120;&#20989;&#25968;&#27809;&#26377;&#20041;&#21153;&#36981;&#24490;Racket&#35789;&#27861;&#32422;&#23450;&#24182;&#20316;&#20026;&#19968;&#20010;&#21333;&#19968;&#30340;&#25968;&#22788;&#29702;&#36830;&#32493;&#24207;&#21015;<span class="RktInBG"><span class="hspace"></span><span class="RktIn">234567</span><span class="hspace"></span></span>&#12290;&#30001;&#20110;&#21482;&#26377;<span class="RktInBG"><span class="hspace"></span><span class="RktIn">23456</span><span class="hspace"></span></span>&#37096;&#20998;&#34987;<span class="RktSym">read</span>&#25110;<span class="RktSym">read-syntax</span>&#25152;&#25509;&#21463;&#65292;<span class="RktInBG"><span class="hspace"></span><span class="RktIn">7</span><span class="hspace"></span></span>&#20173;&#28982;&#38656;&#35201;&#29992;&#36890;&#24120;&#30340;Racket&#26041;&#24335;&#36827;&#34892;&#20998;&#26512;&#12290;&#21516;&#26679;&#65292;&#26469;&#33258;<span class="stt">"five.rkt"</span>&#30340;&#35835;&#21462;&#22120;&#20989;&#25968;&#27809;&#26377;&#20041;&#21153;&#24573;&#30053;&#31354;&#30333;&#65292;&#20197;&#21450;</p><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><font class="badlink"><span class="RktModLink"><span class="RktMod">#lang</span></span></font><span class="hspace">&nbsp;</span><font class="badlink"><span class="RktModLink"><span class="RktSym">racket/base</span></span></font></td></tr><tr><td><span class="hspace">&nbsp;</span></td></tr><tr><td><span class="RktVal">'</span><span class="RktVal">(</span><span class="RktVal">1</span><span class="hspace">&nbsp;</span><span class="RktMeta">#reader</span><span class="RktVal">"five.rkt"</span><span class="hspace">&nbsp;</span><span class="stt">2345</span><span class="RktVal">67</span><span class="hspace">&nbsp;</span><span class="RktVal">8</span><span class="RktVal">)</span></td></tr></table></blockquote><p>&#30456;&#24403;&#20110;</p><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><font class="badlink"><span class="RktModLink"><span class="RktMod">#lang</span></span></font><span class="hspace">&nbsp;</span><font class="badlink"><span class="RktModLink"><span class="RktSym">racket/base</span></span></font></td></tr><tr><td><span class="hspace">&nbsp;</span></td></tr><tr><td><span class="RktVal">'</span><span class="RktVal">(</span><span class="RktVal">1</span><span class="hspace">&nbsp;</span><span class="RktVal">(</span><span class="RktVal">" 2345"</span><span class="RktVal">)</span><span class="hspace">&nbsp;</span><span class="RktVal">67</span><span class="hspace">&nbsp;</span><span class="RktVal">8</span><span class="RktVal">)</span></td></tr></table></blockquote><p>&#30001;&#20110;<span class="RktVal">"five.rkt"</span>&#21518;&#30340;&#31532;&#19968;&#20010;&#23383;&#31526;&#31435;&#21363;&#26159;&#19968;&#20010;&#31354;&#26684;&#12290;</p><p>&#19968;&#20010;<span class="RktMeta">#reader</span>&#34920;&#20063;&#33021;&#22815;&#22312;<a href="intro.html#%28tech._repl%29" class="techoutside" data-pltdoc="x"><span class="techinside">REPL</span></a>&#20013;&#20351;&#29992;&#65306;</p><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">&gt; </span><span class="RktVal">'</span><span class="RktMeta">#reader</span><span class="RktVal">"five.rkt"</span><span class="stt">abcde</span></td></tr><tr><td><p><span class="RktRes">'("abcde")</span></p></td></tr></table></blockquote><h5>17.2.1<tt>&nbsp;</tt><a name="(part._.Source_.Locations)"></a>&#28304;&#20301;&#32622;</h5><p><span class="RktSym">read</span>&#21644;<span class="RktSym">read-syntax</span>&#30340;&#21306;&#21035;&#22312;&#20110;<span class="RktSym">read</span>&#26159;&#29992;&#20110;&#25968;&#25454;&#65292;&#32780; <span class="RktSym">read-syntax</span>&#26159;&#29992;&#26469;&#35299;&#26512;&#31243;&#24207;&#30340;&#12290;&#26356;&#30830;&#20999;&#22320;&#35828;&#65292;&#24403;&#36890;&#36807;Racket&#30340;<span class="RktSym"><span class="badlink"><span class="RktValLink">read</span></span></span>&#35299;&#26512;&#23553;&#38381;&#27969;&#26102;&#65292;&#23558;&#20351;&#29992;<span class="RktSym">read</span>&#20989;&#25968;&#65292;&#24403;&#23553;&#38381;&#27969;&#30001;Racket&#30340;<span class="RktSym"><span class="badlink"><span class="RktValLink">read-syntax</span></span></span>&#20989;&#25968;&#35299;&#26512;&#26102;&#65292;&#20351;&#29992;<span class="RktSym">read-syntax</span>&#12290;&#27809;&#26377;&#20160;&#20040;&#38656;&#35201;<span class="RktSym">read</span>&#21644;<span class="RktSym">read-syntax</span>&#29992;&#21516;&#26679;&#30340;&#26041;&#27861;&#35299;&#26512;&#36755;&#20837;&#65292;&#20294;&#26159;&#20351;&#23427;&#20204;&#19981;&#21516;&#20250;&#28151;&#28102;&#31243;&#24207;&#21592;&#21644;&#24037;&#20855;&#12290;</p><p><span class="RktSym">read-syntax</span>&#20989;&#25968;&#21487;&#20197;&#36820;&#22238;&#19982;<span class="RktSym">read</span>&#30456;&#21516;&#30340;&#20540;&#65292;&#20294;&#23427;&#36890;&#24120;&#24212;&#35813;&#36820;&#22238;&#19968;&#20010;<a href="stx-obj.html#%28tech._~e8~af~ad~e6~b3~95~e5~af~b9~e8~b1~a1~ef~bc~88syntax._object~ef~bc~89%29" class="techoutside" data-pltdoc="x"><span class="techinside">&#35821;&#27861;&#23545;&#35937;&#65288;syntax object&#65289;</span></a>&#65292;&#23427;&#23558;&#35299;&#26512;&#34920;&#36798;&#24335;&#19982;&#28304;&#20301;&#32622;&#36830;&#25509;&#36215;&#26469;&#12290;&#19982;<span class="stt">"five.rkt"</span>&#30340;&#20363;&#23376;&#19981;&#21516;&#30340;&#26159;&#65292;<span class="RktSym">read-syntax</span>&#20989;&#25968;&#36890;&#24120;&#26159;&#30452;&#25509;&#23454;&#29616;&#29983;&#25104;<a href="stx-obj.html#%28tech._~e8~af~ad~e6~b3~95~e5~af~b9~e8~b1~a1~ef~bc~88syntax._object~ef~bc~89%29" class="techoutside" data-pltdoc="x"><span class="techinside">&#35821;&#27861;&#23545;&#35937;&#65288;syntax object&#65289;</span></a>&#65292;&#28982;&#21518;<span class="RktSym">read</span>&#21487;&#20197;&#20351;&#29992;<span class="RktSym">read-syntax</span>&#21644;&#25581;&#24320;<a href="stx-obj.html#%28tech._~e8~af~ad~e6~b3~95~e5~af~b9~e8~b1~a1~ef~bc~88syntax._object~ef~bc~89%29" class="techoutside" data-pltdoc="x"><span class="techinside">&#35821;&#27861;&#23545;&#35937;&#65288;syntax object&#65289;</span></a>&#23553;&#35013;&#22120;&#20197;&#20135;&#29983;&#19968;&#20010;&#21407;&#29983;&#30340;&#32467;&#26524;&#12290;</p><p>&#19979;&#38754;&#30340;<span class="stt">"arith.rkt"</span>&#27169;&#22359;&#23454;&#29616;&#20102;&#19968;&#20010;&#35835;&#21462;&#22120;&#20197;&#35299;&#26512;&#31616;&#21333;&#30340;&#20013;&#32512;&#31639;&#26415;&#34920;&#36798;&#24335;&#20026;Racket&#34920;&#12290;&#20363;&#22914;&#65292;<span class="RktInBG"><span class="hspace"></span><span class="RktIn">1*2+3</span><span class="hspace"></span></span>&#35299;&#26512;&#25104;Racket&#34920;<span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">+</span></span></span><span class="stt"> </span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">*</span></span></span><span class="stt"> </span><span class="RktVal">1</span><span class="stt"> </span><span class="RktVal">2</span><span class="RktPn">)</span><span class="stt"> </span><span class="RktVal">3</span><span class="RktPn">)</span>&#12290;&#25903;&#25345;&#30340;&#36816;&#31639;&#31526;&#26159;<span class="RktInBG"><span class="hspace"></span><span class="RktIn">+</span><span class="hspace"></span></span>&#12289;<span class="RktInBG"><span class="hspace"></span><span class="RktIn">-</span><span class="hspace"></span></span>&#12289;<span class="RktInBG"><span class="hspace"></span><span class="RktIn">*</span><span class="hspace"></span></span>&#21644;<span class="RktInBG"><span class="hspace"></span><span class="RktIn">/</span><span class="hspace"></span></span>&#65292;&#32780;&#25805;&#20316;&#25968;&#21487;&#20197;&#26159;&#26080;&#31526;&#21495;&#25972;&#25968;&#25110;&#21333;&#23383;&#27597;&#21464;&#37327;&#12290;&#35813;&#23454;&#29616;&#20351;&#29992;<span class="RktSym"><span class="badlink"><span class="RktValLink">port-next-location</span></span></span>&#33719;&#21462;&#24403;&#21069;&#28304;&#20301;&#32622;&#65292;&#24182;&#20351;&#29992; <span class="RktSym"><span class="badlink"><span class="RktValLink">datum-&gt;syntax</span></span></span>&#23558;&#21407;&#22987;&#20540;&#36716;&#25442;&#20026;<a href="stx-obj.html#%28tech._~e8~af~ad~e6~b3~95~e5~af~b9~e8~b1~a1~ef~bc~88syntax._object~ef~bc~89%29" class="techoutside" data-pltdoc="x"><span class="techinside">&#35821;&#27861;&#23545;&#35937;&#65288;syntax object&#65289;</span></a>&#12290;</p><blockquote class="SCodeFlow"><blockquote class="Rfilebox"><p class="Rfiletitle"><span class="Rfilename"><span class="stt">"arith.rkt"</span></span></p><blockquote class="Rfilecontent"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><font class="badlink"><span class="RktModLink"><span class="RktMod">#lang</span></span></font><span class="hspace">&nbsp;</span><font class="badlink"><span class="RktModLink"><span class="RktSym">racket</span></span></font></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">require</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">syntax/readerr</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;</span></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">provide</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym"><span class="badlink"><span class="RktValLink">read</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym"><span class="badlink"><span class="RktValLink">read-syntax</span></span></span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;</span></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">read</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">in</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">syntax-&gt;datum</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">read-syntax</span></span></span><span class="hspace">&nbsp;</span><span class="RktVal">#f</span><span class="hspace">&nbsp;</span><span class="RktSym">in</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;</span></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">read-syntax</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">src</span><span class="hspace">&nbsp;</span><span class="RktSym">in</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym">skip-whitespace</span><span class="hspace">&nbsp;</span><span class="RktSym">in</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym">read-arith</span><span class="hspace">&nbsp;</span><span class="RktSym">src</span><span class="hspace">&nbsp;</span><span class="RktSym">in</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;</span></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">skip-whitespace</span><span class="hspace">&nbsp;</span><span class="RktSym">in</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">regexp-match</span></span></span><span class="hspace">&nbsp;</span><span class="RktVal">#px"^\\s*"</span><span class="hspace">&nbsp;</span><span class="RktSym">in</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;</span></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">read-arith</span><span class="hspace">&nbsp;</span><span class="RktSym">src</span><span class="hspace">&nbsp;</span><span class="RktSym">in</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define-values</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">line</span><span class="hspace">&nbsp;</span><span class="RktSym">col</span><span class="hspace">&nbsp;</span><span class="RktSym">pos</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">port-next-location</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">in</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">expr-match</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">regexp-match</span></span></span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktCmt">;</span><span class="RktCmt">&nbsp;</span><span class="RktCmt">Match an operand followed by any number of </span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktCmt">;</span><span class="RktCmt">&nbsp;</span><span class="RktCmt">operator</span><span class="RktCmt">&ndash;</span><span class="RktCmt">operand sequences, and prohibit an</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktCmt">;</span><span class="RktCmt">&nbsp;</span><span class="RktCmt">additional operator from following immediately:</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktVal">#px"^([a-z]|[0-9]+)(?:[-+*/]([a-z]|[0-9]+))*(?![-+*/])"</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktSym">in</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">to-syntax</span><span class="hspace">&nbsp;</span><span class="RktSym">v</span><span class="hspace">&nbsp;</span><span class="RktSym">delta</span><span class="hspace">&nbsp;</span><span class="RktSym">span-str</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">datum-&gt;syntax</span></span></span><span class="hspace">&nbsp;</span><span class="RktVal">#f</span><span class="hspace">&nbsp;</span><span class="RktSym">v</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">make-srcloc</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">delta</span><span class="hspace">&nbsp;</span><span class="RktSym">span-str</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">make-srcloc</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">delta</span><span class="hspace">&nbsp;</span><span class="RktSym">span-str</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">and</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">line</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">vector</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">src</span><span class="hspace">&nbsp;</span><span class="RktSym">line</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">+</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">col</span><span class="hspace">&nbsp;</span><span class="RktSym">delta</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">+</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">pos</span><span class="hspace">&nbsp;</span><span class="RktSym">delta</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">string-length</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">span-str</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">parse-expr</span><span class="hspace">&nbsp;</span><span class="RktSym">s</span><span class="hspace">&nbsp;</span><span class="RktSym">delta</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">match</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">or</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">regexp-match</span></span></span><span class="hspace">&nbsp;</span><span class="RktVal">#rx"^(.*?)([+-])(.*)$"</span><span class="hspace">&nbsp;</span><span class="RktSym">s</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">regexp-match</span></span></span><span class="hspace">&nbsp;</span><span class="RktVal">#rx"^(.*?)([*/])(.*)$"</span><span class="hspace">&nbsp;</span><span class="RktSym">s</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">[</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">list</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym"><span class="badlink"><span class="RktValLink">_</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">a-str</span><span class="hspace">&nbsp;</span><span class="RktSym">op-str</span><span class="hspace">&nbsp;</span><span class="RktSym">b-str</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">a-len</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">string-length</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">a-str</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">a</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">parse-expr</span><span class="hspace">&nbsp;</span><span class="RktSym">a-str</span><span class="hspace">&nbsp;</span><span class="RktSym">delta</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">b</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">parse-expr</span><span class="hspace">&nbsp;</span><span class="RktSym">b-str</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">+</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">delta</span><span class="hspace">&nbsp;</span><span class="RktVal">1</span><span class="hspace">&nbsp;</span><span class="RktSym">a-len</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">op</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">to-syntax</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">string-&gt;symbol</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">op-str</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">+</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">delta</span><span class="hspace">&nbsp;</span><span class="RktSym">a-len</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktSym">op-str</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym">to-syntax</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">list</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">op</span><span class="hspace">&nbsp;</span><span class="RktSym">a</span><span class="hspace">&nbsp;</span><span class="RktSym">b</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktSym">delta</span><span class="hspace">&nbsp;</span><span class="RktSym">s</span><span class="RktPn">)</span><span class="RktPn">]</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">[</span><span class="RktSym"><span class="badlink"><span class="RktValLink">_</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">to-syntax</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">or</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">string-&gt;number</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">s</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">string-&gt;symbol</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">s</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktSym">delta</span><span class="hspace">&nbsp;</span><span class="RktSym">s</span><span class="RktPn">)</span><span class="RktPn">]</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">unless</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">expr-match</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">raise-read-error</span></span></span><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktVal">"&#38169;&#35823;&#30340;&#31639;&#26415;&#34920;&#36798;&#24335;"</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktSym">src</span><span class="hspace">&nbsp;</span><span class="RktSym">line</span><span class="hspace">&nbsp;</span><span class="RktSym">col</span><span class="hspace">&nbsp;</span><span class="RktSym">pos</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">and</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">pos</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">-</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">file-position</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">in</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktSym">pos</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym">parse-expr</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">bytes-&gt;string/utf-8</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">car</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">expr-match</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktVal">0</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></blockquote></blockquote></blockquote><p>&#22914;&#26524;<span class="stt">"arith.rkt"</span>&#35835;&#21462;&#22120;&#22312;&#19968;&#20010;&#34920;&#36798;&#24335;&#20301;&#32622;&#20013;&#20351;&#29992;&#65292;&#37027;&#20040;&#23427;&#30340;&#35299;&#26512;&#32467;&#26524;&#23558;&#34987;&#35270;&#20026;&#19968;&#20010;Racket&#34920;&#36798;&#12290;&#20294;&#26159;&#65292;&#22914;&#26524;&#23427;&#34987;&#29992;&#22312;&#24341;&#29992;&#30340;&#34920;&#20013;&#65292;&#37027;&#20040;&#23427;&#21482;&#29983;&#25104;&#19968;&#20010;&#25968;&#23383;&#25110;&#19968;&#20010;&#21015;&#34920;&#65306;</p><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">&gt; </span><span class="RktMeta">#reader</span><span class="RktVal">"arith.rkt"</span><span class="hspace">&nbsp;</span><span class="stt">1*2+3</span></td></tr><tr><td><p><span class="RktRes">5</span></p></td></tr><tr><td><span class="stt">&gt; </span><span class="RktVal">'</span><span class="RktMeta">#reader</span><span class="RktVal">"arith.rkt"</span><span class="hspace">&nbsp;</span><span class="stt">1*2+3</span></td></tr><tr><td><p><span class="RktRes">'(+ (* 1 2) 3)</span></p></td></tr></table></blockquote><p><span class="stt">"arith.rkt"</span>&#35835;&#21462;&#22120;&#20063;&#21487;&#20197;&#22312;&#27627;&#26080;&#24847;&#20041;&#30340;&#20301;&#32622;&#20013;&#20351;&#29992;&#12290;&#30001;&#20110;<span class="RktSym">read-syntax</span>&#23454;&#29616;&#36319;&#36394;&#28304;&#20301;&#32622;&#65292;&#35821;&#27861;&#38169;&#35823;&#33267;&#23569;&#21487;&#20197;&#26681;&#25454;&#21407;&#22987;&#20301;&#32622;&#65288;&#22312;&#38169;&#35823;&#28040;&#24687;&#30340;&#24320;&#22836;&#65289;&#24341;&#29992;&#36755;&#20837;&#37096;&#20998;&#65306;</p><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">let</span></span></span><span class="hspace">&nbsp;</span><span class="RktMeta">#reader</span><span class="RktVal">"arith.rkt"</span><span class="hspace">&nbsp;</span><span class="stt">1*2+3</span><span class="hspace">&nbsp;</span><span class="RktVal">8</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktErr">repl:1:27: let: bad syntax (not an identifier and expression</span></p></td></tr><tr><td><p><span class="RktErr">for a binding)</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">at: +</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">in: (let (+ (* 1 2) 3) 8)</span></p></td></tr></table></blockquote><h5>17.2.2<tt>&nbsp;</tt><a name="(part._readtable)"></a>readtable&#65288;&#35835;&#21462;&#34920;&#26684;&#65289;</h5><p>&#19968;&#20010;&#35835;&#21462;&#22120;&#25193;&#23637;&#23545;&#20197;&#20219;&#24847;&#26041;&#24335;&#35299;&#26512;&#36755;&#20837;&#23383;&#31526;&#30340;&#33021;&#21147;&#21487;&#20197;&#26159;&#24378;&#22823;&#30340;&#65292;&#20294;&#24456;&#22810;&#24773;&#20917;&#19979;&#65292;&#35789;&#27719;&#25193;&#23637;&#38656;&#35201;&#19968;&#20010;&#19981;&#37027;&#20040;&#19968;&#33324;&#20294;&#26356;&#21487;&#32452;&#21512;&#30340;&#26041;&#27861;&#12290;&#21516;&#26679;&#65292;Racket&#35821;&#27861;&#30340;<a href="Pairs-Lists-and-Racket-Syntax.html#%28tech._~e6~89~a9~e5~b1~95~e5~99~a8~ef~bc~88expander~ef~bc~89%29" class="techoutside" data-pltdoc="x"><span class="techinside">&#25193;&#23637;&#22120;&#65288;expander&#65289;</span></a>&#31561;&#32423;&#21487;&#20197;&#36890;&#36807;<font class="badlink"><span class="techoutside"><span class="techinside">&#23439;&#65288;macros&#65289;</span></span></font>&#26469;&#25193;&#23637;&#65292;Racket&#35821;&#27861;&#30340;<font class="badlink"><span class="techoutside"><span class="techinside">reader</span></span></font>&#31561;&#32423;&#21487;&#20197;&#36890;&#36807;&#19968;&#20010;<a name="(tech._readtable)"></a><span style="font-style: italic">readtable</span>&#26469;&#22797;&#21512;&#25193;&#23637;&#12290;</p><p>Racket&#35835;&#21462;&#22120;&#26159;&#19968;&#20010;&#36882;&#24402;&#19979;&#38477;&#35299;&#26512;&#22120;&#65292;&#20197;&#21450;<a href="#%28tech._readtable%29" class="techoutside" data-pltdoc="x"><span class="techinside">readtable</span></a>&#26144;&#23556;&#29305;&#24449;&#21040;&#35299;&#26512;&#22788;&#29702;&#22120;&#12290;&#20363;&#22914;&#65292;&#40664;&#35748;readtable&#26144;&#23556;<span class="RktInBG"><span class="hspace"></span><span class="RktIn">(</span><span class="hspace"></span></span>&#21040;&#19968;&#20010;&#22788;&#29702;&#22120;&#65292;&#23427;&#36882;&#24402;&#35299;&#26512;&#23376;&#34920;&#30452;&#21040;&#25214;&#21040;&#19968;&#20010;<span class="RktInBG"><span class="hspace"></span><span class="RktIn">)</span><span class="hspace"></span></span>&#12290;<span class="RktSym"><span class="badlink"><span class="RktValLink">current-readtable</span></span></span><font class="badlink"><span class="techoutside"><span class="techinside">&#21442;&#25968;&#65288;parameter&#65289;</span></span></font>&#20915;&#23450;<a href="#%28tech._readtable%29" class="techoutside" data-pltdoc="x"><span class="techinside">readtable</span></a>&#30001;<span class="RktSym"><span class="badlink"><span class="RktValLink">read</span></span></span>&#25110;<span class="RktSym"><span class="badlink"><span class="RktValLink">read-syntax</span></span></span>&#20351;&#29992;&#12290;&#32780;&#19981;&#26159;&#30452;&#25509;&#35299;&#26512;&#21407;&#22987;&#29305;&#24449;&#65292;&#19968;&#20010;&#35835;&#21462;&#22120;&#25193;&#23637;&#21487;&#20197;&#23433;&#35013;&#19968;&#20010;&#25193;&#23637;&#30340;<a href="#%28tech._readtable%29" class="techoutside" data-pltdoc="x"><span class="techinside">readtable</span></a>&#28982;&#21518;&#38142;&#25509;<span class="RktSym"><span class="badlink"><span class="RktValLink">read</span></span></span>&#25110;<span class="RktSym"><span class="badlink"><span class="RktValLink">read-syntax</span></span></span>&#12290;</p><blockquote class="refpara"><blockquote class="refcolumn"><blockquote class="refcontent"><p><span class="imageleft"><img src="finger.png" alt="+" width="24" height="24"/></span>&#21442;&#35265;&#12298;<a href="parameterize.html" data-pltdoc="x">&#21160;&#24577;&#32465;&#23450;&#65306;<span class="RktSym"><span class="badlink"><span class="RktValLink">parameterize</span></span></span></a>&#12299;&#8212;&#8212;&#23545;&#12298;<a href="parameterize.html#%28tech._parameter%29" class="techoutside" data-pltdoc="x"><span class="techinside">parameters</span></a>&#12299;&#30340;&#20171;&#32461;&#12290;</p></blockquote></blockquote></blockquote><p><span class="RktSym"><span class="badlink"><span class="RktValLink">make-readtable</span></span></span>&#20989;&#25968;&#26500;&#24314;&#19968;&#20010;&#26032;&#30340;<a href="#%28tech._readtable%29" class="techoutside" data-pltdoc="x"><span class="techinside">readtable</span></a>&#20316;&#20026;&#19968;&#20010;&#29616;&#26377;&#30340;&#19968;&#20010;&#25193;&#23637;&#12290;&#23427;&#26681;&#25454;&#19968;&#20010;&#23383;&#31526;&#12289;&#19968;&#20010;&#23383;&#31526;&#26144;&#23556;&#31867;&#22411;&#21644;&#65288;&#23545;&#20110;&#30340;&#26576;&#20123;&#26144;&#23556;&#30340;&#31867;&#22411;&#65289;&#19968;&#20010;&#35299;&#26512;&#31243;&#24207;&#25509;&#21463;&#19968;&#31995;&#21015;&#35268;&#33539;&#12290;&#20363;&#22914;&#65292;&#25193;&#23637;readtable&#20351;<span class="RktInBG"><span class="hspace"></span><span class="RktIn">$</span><span class="hspace"></span></span>&#21487;&#20197;&#29992;&#26469;&#24320;&#22987;&#21644;&#32467;&#26463;&#20013;&#32512;&#34920;&#36798;&#24335;&#65292;&#23454;&#29616;<span class="RktSym">read-dollar</span>&#20989;&#25968;&#24182;&#20351;&#29992;&#65306;</p><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">make-readtable</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">current-readtable</span></span></span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktVal">#\$</span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">terminating-macro</span><span class="hspace">&nbsp;</span><span class="RktSym">read-dollar</span><span class="RktPn">)</span></td></tr></table></blockquote><p><span class="RktSym">read-dollar</span>&#21327;&#35758;&#35201;&#27714;&#20989;&#25968;&#25509;&#21463;&#19981;&#21516;&#21442;&#25968;&#30340;&#25968;&#20540;&#65292;&#36825;&#21462;&#20915;&#20110;&#23427;&#26159;&#21542;&#34987;&#29992;&#20110;<span class="RktSym"><span class="badlink"><span class="RktValLink">read</span></span></span>&#25110;<span class="RktSym"><span class="badlink"><span class="RktValLink">read-syntax</span></span></span>&#27169;&#24335;&#12290;&#22312;<span class="RktSym"><span class="badlink"><span class="RktValLink">read</span></span></span>&#27169;&#24335;&#20013;&#65292;&#35299;&#26512;&#22120;&#20989;&#25968;&#32473;&#20986;&#20004;&#20010;&#21442;&#25968;&#65306;&#35302;&#21457;&#35299;&#26512;&#22120;&#20989;&#25968;&#30340;&#23383;&#31526;&#21644;&#27491;&#22312;&#35835;&#21462;&#30340;&#36755;&#20837;&#31471;&#21475;&#12290;&#22312;<span class="RktSym"><span class="badlink"><span class="RktValLink">read-syntax</span></span></span>&#27169;&#24335;&#20013;&#65292;&#20989;&#25968;&#24517;&#39035;&#25509;&#21463;&#25552;&#20379;&#23383;&#31526;&#28304;&#20301;&#32622;&#30340;&#22235;&#20010;&#38468;&#21152;&#21442;&#25968;&#12290;</p><p>&#19979;&#38754;&#30340;<span class="stt">"dollar.rkt"</span>&#27169;&#22359;&#26681;&#25454;&#34987;<span class="stt">"arith.rkt"</span>&#25552;&#20379;&#30340;<span class="RktSym">read</span>&#21644;<span class="RktSym">read-syntax</span>&#20989;&#25968;&#23450;&#20041;&#20102;&#19968;&#20010;<span class="RktSym">read-dollar</span>&#20989;&#25968;&#65292;&#24182;&#23558;<span class="RktSym">read-dollar</span>&#36830;&#21516;&#26032;&#30340;<span class="RktSym">read</span>&#21644;<span class="RktSym">read-syntax</span>&#20989;&#25968;&#25918;&#22312;&#19968;&#36215;&#65292;&#23427;&#23433;&#35013;readtable&#24182;&#38142;&#25509;Racket&#30340;<span class="RktSym"><span class="badlink"><span class="RktValLink">read</span></span></span>&#25110;<span class="RktSym"><span class="badlink"><span class="RktValLink">read-syntax</span></span></span>&#65306;</p><blockquote class="SCodeFlow"><blockquote class="Rfilebox"><p class="Rfiletitle"><span class="Rfilename"><span class="stt">"dollar.rkt"</span></span></p><blockquote class="Rfilecontent"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><font class="badlink"><span class="RktModLink"><span class="RktMod">#lang</span></span></font><span class="hspace">&nbsp;</span><font class="badlink"><span class="RktModLink"><span class="RktSym">racket</span></span></font></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">require</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">syntax/readerr</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">prefix-in</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">arith:</span><span class="hspace">&nbsp;</span><span class="RktVal">"arith.rkt"</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;</span></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">provide</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">rename-out</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">[</span><span class="RktSym">$-read</span><span class="hspace">&nbsp;</span><span class="RktSym"><span class="badlink"><span class="RktValLink">read</span></span></span><span class="RktPn">]</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">[</span><span class="RktSym">$-read-syntax</span><span class="hspace">&nbsp;</span><span class="RktSym"><span class="badlink"><span class="RktValLink">read-syntax</span></span></span><span class="RktPn">]</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;</span></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">$-read</span><span class="hspace">&nbsp;</span><span class="RktSym">in</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">parameterize</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktPn">[</span><span class="RktSym"><span class="badlink"><span class="RktValLink">current-readtable</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">make-$-readtable</span><span class="RktPn">)</span><span class="RktPn">]</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">read</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">in</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;</span></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">$-read-syntax</span><span class="hspace">&nbsp;</span><span class="RktSym">src</span><span class="hspace">&nbsp;</span><span class="RktSym">in</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">parameterize</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktPn">[</span><span class="RktSym"><span class="badlink"><span class="RktValLink">current-readtable</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">make-$-readtable</span><span class="RktPn">)</span><span class="RktPn">]</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">read-syntax</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">src</span><span class="hspace">&nbsp;</span><span class="RktSym">in</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;</span></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">make-$-readtable</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">make-readtable</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">current-readtable</span></span></span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktVal">#\$</span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">terminating-macro</span><span class="hspace">&nbsp;</span><span class="RktSym">read-dollar</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;</span></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">read-dollar</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">case-lambda</span></span></span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;</span><span class="RktPn">[</span><span class="RktPn">(</span><span class="RktSym">ch</span><span class="hspace">&nbsp;</span><span class="RktSym">in</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym">check-$-after</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">arith:read</span><span class="hspace">&nbsp;</span><span class="RktSym">in</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktSym">in</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">object-name</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">in</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">]</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;</span><span class="RktPn">[</span><span class="RktPn">(</span><span class="RktSym">ch</span><span class="hspace">&nbsp;</span><span class="RktSym">in</span><span class="hspace">&nbsp;</span><span class="RktSym">src</span><span class="hspace">&nbsp;</span><span class="RktSym">line</span><span class="hspace">&nbsp;</span><span class="RktSym">col</span><span class="hspace">&nbsp;</span><span class="RktSym">pos</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym">check-$-after</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">arith:read-syntax</span><span class="hspace">&nbsp;</span><span class="RktSym">src</span><span class="hspace">&nbsp;</span><span class="RktSym">in</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktSym">in</span><span class="hspace">&nbsp;</span><span class="RktSym">src</span><span class="RktPn">)</span><span class="RktPn">]</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;</span></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">check-$-after</span><span class="hspace">&nbsp;</span><span class="RktSym">val</span><span class="hspace">&nbsp;</span><span class="RktSym">in</span><span class="hspace">&nbsp;</span><span class="RktSym">src</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">regexp-match</span></span></span><span class="hspace">&nbsp;</span><span class="RktVal">#px"^\\s*"</span><span class="hspace">&nbsp;</span><span class="RktSym">in</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktCmt">;</span><span class="RktCmt">&nbsp;</span><span class="RktCmt">skip whitespace</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">let</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktPn">[</span><span class="RktSym">ch</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">peek-char</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">in</span><span class="RktPn">)</span><span class="RktPn">]</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">unless</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">equal?</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">ch</span><span class="hspace">&nbsp;</span><span class="RktVal">#\$</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">bad-ending</span><span class="hspace">&nbsp;</span><span class="RktSym">ch</span><span class="hspace">&nbsp;</span><span class="RktSym">src</span><span class="hspace">&nbsp;</span><span class="RktSym">in</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">read-char</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">in</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktSym">val</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;</span></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">define</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">bad-ending</span><span class="hspace">&nbsp;</span><span class="RktSym">ch</span><span class="hspace">&nbsp;</span><span class="RktSym">src</span><span class="hspace">&nbsp;</span><span class="RktSym">in</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">let-values</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktPn">[</span><span class="RktPn">(</span><span class="RktSym">line</span><span class="hspace">&nbsp;</span><span class="RktSym">col</span><span class="hspace">&nbsp;</span><span class="RktSym">pos</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">port-next-location</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">in</span><span class="RktPn">)</span><span class="RktPn">]</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">if</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">eof-object?</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">ch</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktSym"><span class="badlink"><span class="RktValLink">raise-read-error</span></span></span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktSym"><span class="badlink"><span class="RktValLink">raise-read-eof-error</span></span></span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktVal">"expected a closing `$'"</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktSym">src</span><span class="hspace">&nbsp;</span><span class="RktSym">line</span><span class="hspace">&nbsp;</span><span class="RktSym">col</span><span class="hspace">&nbsp;</span><span class="RktSym">pos</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">if</span></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">eof-object?</span></span></span><span class="hspace">&nbsp;</span><span class="RktSym">ch</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktVal">0</span><span class="hspace">&nbsp;</span><span class="RktVal">1</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></blockquote></blockquote></blockquote><p>&#36825;&#20010;&#35835;&#21462;&#22120;&#25193;&#23637;&#65292;&#19968;&#20010;&#21333;&#19968;&#30340;<span class="RktMeta">#reader</span>&#21487;&#29992;&#20110;&#19968;&#20010;&#34920;&#36798;&#24335;&#30340;&#24320;&#22987;&#20197;&#20351;&#20132;&#25442;&#20013;&#32512;&#31639;&#27861;&#30340;<span class="RktInBG"><span class="hspace"></span><span class="RktIn">$</span><span class="hspace"></span></span>&#30340;&#22810;&#37325;&#20351;&#29992;&#25104;&#20026;&#21487;&#33021;&#65306;</p><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">&gt; </span><span class="RktMeta">#reader</span><span class="RktVal">"dollar.rkt"</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><span class="badlink"><span class="RktValLink">let</span></span></span><span class="stt"> </span><span class="RktPn">(</span><span class="RktPn">[</span><span class="RktSym">a</span><span class="stt"> </span><span class="stt">$1*2+3$</span><span class="RktPn">]</span><span class="stt"> </span><span class="RktPn">[</span><span class="RktSym">b</span><span class="stt"> </span><span class="stt">$5/6$</span><span class="RktPn">]</span><span class="RktPn">)</span><span class="stt"> </span><span class="RktSym">$a+b$</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">35/6</span></p></td></tr></table></blockquote><div class="navsetbottom"><span class="navleft"><div class="nosearchform"></div>&nbsp;&nbsp;</span><span class="navright">&nbsp;&nbsp;<a href="module-languages.html" title="backward to &quot;17.1 模块（module）语言&quot;" data-pltdoc="x">&larr; prev</a>&nbsp;&nbsp;<a href="languages.html" title="up to &quot;17 创造语言&quot;" data-pltdoc="x">up</a>&nbsp;&nbsp;<a href="hash-languages.html" title="forward to &quot;17.3 定义新的#lang语言&quot;" data-pltdoc="x">next &rarr;</a></span>&nbsp;</div></div></div><div id="contextindicator">&nbsp;</div></body></html>